using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
using DecisionMaking.Domain;

namespace DecisionMaking.BusinessLogic.Model
{
	public class CueModel
	{
	    public CueModel ()
		{
		    AttributeValues = new List<CueAttributeValueModel>();
		}

	    public int? CueId {get; set; }
		
		public int EnvironmentId {get; set; }
		
		[Required]
		[DisplayName("Name")]	
		[DataType(DataType.Text)]
		[StringLength(50)]			
		public string Name {get; set; }

        [Required]
        [DisplayName("Order")]
        public int Order { get; set; }

	    public IList<CueAttributeValueModel> AttributeValues { get; set; }
        
        /// <summary>
        /// Initializes the AttributeValues for this model
        /// </summary>
        /// <param name="attributes"></param>
        public void InitAttributes(IEnumerable<CueAttribute> attributes)
        {
            foreach(var a in attributes)
            {
                AttributeValues.Add(new CueAttributeValueModel{CueAttributeId = a.Id, Name = a.Name});
            }
        }
	}

    public class CueAttributeValueModel
    {
        public int CueAttributeId { get; set; }
        public string Name { get; set; }
        public double? Value { get; set; }
    }
}

